package com.tssrv.main;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class DataAnalysis {
	public static void main(String args[]){
		testData(null);
	}
	
	public static void testData(String directory){
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("D:/key_delay.txt")), "utf-8"));
			String buffer;
			Map<String, Integer> map = new HashMap<>();
			while ((buffer = br.readLine()) != null){
				if (map.containsKey(buffer)){
					map.put(buffer, map.get(buffer) + 1);
				}else{
					map.put(buffer, 1);
				}
			}
			for (Entry<String, Integer> entry : map.entrySet()) {  
				  
			    System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());  
			  
			}  
			
			
		}  catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
